#include <header.h>

int main(){

    char *port = "8080";
    char *ip = "0.0.0.0";
    int socket_fd = socket(AF_INET, SOCK_STREAM, 0);
    struct sockaddr_in sock;
    sock.sin_family = AF_INET;
    sock.sin_port = htons(atoi(port));
    sock.sin_addr.s_addr = inet_addr(ip);
    bind(socket_fd, (struct sockaddr *)&sock, sizeof(sock));
    listen(socket_fd, 10);
    int net_fd= accept(socket_fd, NULL, NULL);

    // --------------------------------------
    char buf[100]= {0};
    recv(net_fd, buf, sizeof(buf), MSG_WAITALL);

    printf("buf: %s \n", buf);

    // -----------------------------------------

    close(net_fd);
    close(socket_fd);
    return 0;
}

